package com.matt.service;

import com.matt.commons.dto.sso.StaffDTO;
import com.matt.domain.Clientele;
import com.matt.domain.Contract;
import com.matt.foundation.model.StatusResponse;
import com.matt.foundation.query.ContractQuery;
import com.matt.foundation.vo.ClienteleContractVo;
import com.matt.foundation.vo.ContractExportVo;
import com.matt.foundation.vo.ContractVo;
import com.matt.foundation.vo.PayVo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * **************************
 * Created by Ron
 * from com.matt
 * on 2018/6/14 0014.
 * *************************
 */
public interface ContractService {

    Contract createContract(StaffDTO staff, Clientele clientele, String name, String orderNO,
                            Date beginDate, Date endDate,
                            BigDecimal totalAmount, String productRecords);

    Contract save(StaffDTO staff, Contract contract, String productRecords);

    Contract processContractStatus(Contract contract, Date today);

    Page<ContractVo> findByCondition(ContractQuery contractQuery, Pageable pageable);

    List<ContractExportVo> findByConditionExport(ContractQuery contractQuery);

    List<ClienteleContractVo> findContractBySyschildName(String areaId, String sysChildName);

    Contract breakDown(StaffDTO staff, String contractId, String breakDownReason, String breakDownRemark);

    ContractVo details(String contractId);

    List<Contract> contractsByClientele(String areaId, String clienteleId);

    //2019-01-09删除
//    List<Contract> findByName(String areaId, String contractTitle);

    Contract updateContractStaffInfo(StaffDTO operator, StaffDTO staff, String contractId);

    Boolean ckeckout(BigDecimal practicalAmount, String productRecords);

    Boolean findByClienteleId(String clienteleId);

    //减早教接口
    int reduceSatNum(String clienteleId, Integer num);

    boolean end(Contract contract);

    boolean beginTeachRoll(Contract contract);

    boolean endTeachRoll(Contract contract, String staffId);

    Long findByStatusAndPayStatus(String clienteleId, int i, int i1);

    PayVo getPayTotal(String productJson);
    
    boolean checkConstractCode(String areaId,String contractCode);
    
    StatusResponse freezeContract(StaffDTO staff, String clienteleId, String contractId,String content);
    
    StatusResponse unfreezeContract(StaffDTO staff, String clienteleId, String contractId);
    
    List<ContractVo> findListByClienteleId(String areaId, String clienteleId);


    void processContractPayHistory(Contract contract, String payUser, String headImgUrl, String sourceName);
    void processContractCreateHistory(Contract contract, String headImgUrl);


}
